package com.idheima.d02_duotai_lianxi;

public class Test {
    public static void breed(Animal a){
        a.eat();
        if (a instanceof Cat){
            Cat c = (Cat)a;
            c.eatCatlong();
        }
    }

    public static void main(String[] args) {
        Animal cat = new Cat("小花",2,"公");
        Animal dog = new Dog("旺财",3,"公");
        Animal pig = new Pig("猪猪侠",5,"公");
        System.out.println(cat);
        breed(cat);
        System.out.println(dog);
        breed(dog);
        System.out.println(pig);
        breed(pig);


    }
}
